package com.spa.infrastructure.service.wx.result;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;
import java.util.List;

/**
 * 支付成功通知参数
 */
@Getter
@Setter
@Builder
@ToString
public class PaySuccessResult {

    private String appid;

    private String mchid;

    private String transactionId;

    private String outTradeNo;

    private String tradeType;

    private String tradeState;

    private String tradeStateDesc;

    private String bankType;

    private String attach;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date successTime;

    private Amount amount;

    private Payer payer;

    private SceneInfo sceneInfo;

    @Getter
    @Setter
    @Builder
    public static class Amount {

        private Integer total;

        private Integer payer_total;

        private String currency;

        private String payer_currency;
    }
    @Getter
    @Setter
    @Builder
    public static class Payer {

        private String openid;
    }
    @Getter
    @Setter
    @Builder
    public static class PromotionDetail {

        private Integer amount;

        private String coupon_id;

        private String name;

        private String scope;

        private String type;

        private String stock_id;

        private Integer wechatpay_contribute;

        private Integer merchant_contribute;

        private Integer other_contribute;

        private String currency;

        private List<GoodsDetail> goods_detail;
    }
    @Getter
    @Setter
    @Builder
    public static class GoodsDetail {

        private String goods_remark;

        private String goods_id;

        private Integer discount_amount;

        private Integer quantity;

        private Integer unit_price;

    }
    @Getter
    @Setter
    @Builder
    public static class SceneInfo {

        private String device_id;

    }

}
